#!/bin/bash
# 微信机器人的 Webhook
WEBHOOK_URL="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=679c13df-31d5-4aa0-9711-43f60586f176"
CONTENT_TYPE='Content-Type: application/json'

echo "### send message to wx"
echo "${env}"

curl "$WEBHOOK_URL" \
-H "$CONTENT_TYPE" \
-d '
  {
    "msgtype": "markdown",
    "markdown": {
      "content": "<font color=\"warning\">**【正式】APP构建结果**</font> \n
      > 任务序号：<font color=\"comment\">'"${BUILD_DISPLAY_NAME}"'</font>
      > 任务名称：<font color=\"comment\">'"${JOB_BASE_NAME}"'</font>
      > app名称：<font color=\"comment\">'"${buildName}"'</font>
      > app版本号：<font color=\"comment\">'"${buildVersion}"'</font>
      > 构建版本：<font color=\"comment\">'"${buildBuildVersion}"'</font>
      > 构建分支：<font color=\"comment\">'"${branch}"'</font>
      > 构建环境：<font color=\"comment\">'"assemble${BuildType}"'</font>
      > 应用地址：<font color=\"comment\">[点击查看]('"${appPgyerURL}"')</font>
      > 二维码地址：<font color=\"comment\">[点击查看]('"${appQRCodeURL}"')</font>
      > 更新时间：<font color=\"comment\">'"${buildUpdated}"'</font>
      ><font color=\"warning\">**APP构建完成**</font> "
    }
  }
'

echo "### send message to wx finished！"
